#!/usr/bin/env bash
#拿到所有的SWD进程（PID）
all_process=`ps -ef|grep 'SWD'|grep -v 'grep'|awk '{print $2}'`
for val in $all_process
do
    #该进程PID下的进程
    curr_process=`ps -ef|grep $val|grep -v 'grep'|awk '{print $3}'`
    for value in $curr_process
    do
        if [ $value == 1 ]
        then
            #存在僵尸进程
            echo '父进程：'$val
            child_process=`ps -ef|grep $val|grep -v 'grep'|awk '{print $2}'`
            for c_val in $child_process
            do
                echo '杀死进程PID：'$c_val
                kill -9 $c_val
            done
        fi
    done
done